package me.arraylist.Test;

import java.util.ArrayList;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        for (int i = 1; i < 4; i++) {
            System.out.println("请输入第" + (i) + "个学生的姓名");
            String name = sc.next();
            System.out.println("请输入第" + (i) + "个学生的年龄");
            int age = sc.nextInt();
            Student stu = new Student(name, age);
            list.add(stu);
        }
        for (int i = 0; i < list.size(); i++) {

            System.out.println(list.get(i).getName() + "," + list.get(i).getAge());
        }
    }
}
